# 步序配方的显示名
import os
import json

# 指定目录
directory = r"C:\Users\jan\AppData\Roaming\Mindteco\app_userdata\Cpro\cpro_config\cpro_recipe" 

def find_files(directory, extension):
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith(extension):
                yield os.path.join(root, file)

def read_json(file_path, key):
    with open(file_path, 'r', encoding='utf-8') as file:
        data = json.load(file)
        if key in data:
            return data[key]

def get_values(directory, extension, key):
    values = []
    for file_path in find_files(directory, extension):
        value = read_json(file_path, key)
        if value is not None:
            values.append(value)
    return values

values = get_values(directory, "self.json", "display_name")
values = list(set(values))
print(values)